package com.bit.demo2;

class Animal{
    public String name;
    public int age;
    protected int count;
    public Animal(String name, int age){
        this.name = name;
        this.age = age;

    }
    public void eat(){
        System.out.println("eat()");
    }
}

class Dog extends Animal{
    public Dog(String name, int age){
        super(name, age);
    }

    public void eat(){
        System.out.println("狗狼吞虎咽的eat()");
    }

}

class Bird extends Animal{

    public String wing;
    public Bird(String name, int age, String wing)
    {
        super(name, age);
        this.wing = wing;
    }
    public void fly(){
        System.out.println(name + "fly()");
    }
}
public class TestDemo {

    public static void main(String[] args) {
        Animal animal = new Dog("haha", 19);
        animal.eat();
    }

    public static void main3(String[] args) {
        Dog dog = new Dog("haha", 19);
        Animal animal = dog;
    }
    public static void main2(String[] args) {
        Bird bird = new Bird("heihei",18,"我要的飞翔");
        System.out.println(bird.count);
    }

    public static void main1(String[] args) {
        Dog dog = new Dog("haha",19);

        System.out.println(dog.name);
        dog.eat();

        Bird bird = new Bird("heihei",18,"我要的飞翔");

        System.out.println(bird.name);
        bird.eat();
        bird.fly();
    }
}
